package dao;

import org.apache.ibatis.annotations.*;
import pojo.Notice;

import java.util.List;

/**
 * @author HLF
 * @date 2022/6/15 10:48
 */
public interface NoticeDao {
    @Options(useGeneratedKeys = true, keyProperty = "nid", keyColumn = "nid")
    @Insert("insert into t_notice(context) values(#{context})")
    int insertNotice(Notice notice);

    @Select("select * from t_notice")
    List<Notice> getAllNotices();

    @Delete("delete from t_notice where nid = #{nid}")
    int deleteByNid(Integer nid);

    @Update("update t_notice set context = #{context} where nid = #{nid}")
    int updateNotice(Notice notice);


    @Select("select * from t_notice where nid = #{nid}")
    Notice getByNid(Integer nid);

}
